const {override, fixBabelImports,addLessLoader } = require('customize-cra')

const path = require("path")

module.exports = override(

    config =>{
      config.resolve.alias = {
          "@": path.resolve(__dirname,"src")
      };
      return config;
    },

    //针对 antd实现按需打包，根据import来打包(使用babel-plugin-import)
    fixBabelImports('import',{
        libraryName:'antd',
        libraryDirectory:'es',
        style:true,    //自动打包相关的样式
    }),
    //使用less-loader对源码中的less变量进行重新指定

    // 1. 先卸载less-loader当前版本： yarn remove less-loader
    // 2. 再安装7.0.0左右的版本：yarn add less-loader@7.1.0
    addLessLoader({
        lessOptions:{
            javascriptEnabled: true,
            // modifyVars: { '@primary-color': '#1DA57A' },
        }

    }),
)
